#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "php.h"
#include "php_hello.h"

static function_entry hello_functions[] = {
    PHP_FE(hello_world, NULL)
    PHP_FE(hello_world1, NULL)
    PHP_FE(hello_return_long, NULL)
    PHP_FE(hello_get_long, NULL)
    {NULL, NULL, NULL}
};

zend_module_entry hello_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
    STANDARD_MODULE_HEADER,
#endif
    PHP_HELLO_WORLD_EXTNAME,
    hello_functions,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
#if ZEND_MODULE_API_NO >= 20010901
    PHP_HELLO_WORLD_VERSION,
#endif
    STANDARD_MODULE_PROPERTIES
};

#ifdef COMPILE_DL_HELLO
ZEND_GET_MODULE(hello)
#endif

PHP_FUNCTION(hello_world)
{
    php_printf("This is a test for php_printf ");
    RETURN_STRING("SRK Hello World", 1);
}
PHP_FUNCTION(hello_world1)
{
    php_printf("This is an example to add a new function to the php source code\n ");
    RETURN_STRING("SRK Hello World 1 \n", 1);
}
PHP_FUNCTION(hello_return_long)
{
php_printf("Start Returing long Value \n");
RETURN_LONG(22);
php_printf("End Returing long Value \n");

}
PHP_FUNCTION(hello_get_long)
{
long srk;
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,"l",&srk)==FAILURE)
{
php_printf("Pass an argument to the fucntion \n");
RETURN_NULL();
}

php_printf("Start getting long %ld Value \n",srk);

srk=srk+1;

RETURN_LONG(srk);


}
